home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 March / macformat-022.iso / Shareware City / Developers / MW MPW Binaries 1.1.1a2 / mwcPPC / MWCIncludes / FCntl.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-01-31  |  5.1 KB  |  201 lines  |  [TEXT/MMCC]

  1. /*
  2.     File:        FCntl.h
  3.  
  4.     Contains:    xxx put contents here xxx
  5.  
  6.     Written by:    Jeff Cobb
  7.  
  8.     Copyright:    © 1993 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.          <4>    11/30/93    jrc        (with TW) RADAR #1128006. Add a TrapAvailable prototype
  13.                                     according to Rudy's instructions.
  14.  
  15. */
  16.  
  17. /*
  18.  * FCntl.h -- faccess(), fcntl(), and open() mode flags
  19.  *
  20.  * Portions copyright American Telephone & Telegraph
  21.  * Used with permission, Apple Computer Inc. (1985,1988,1990,1992,1993)
  22.  * All rights reserved.
  23.  *
  24.  * Warning:  This interface is NOT a part of the ANSI C standard.
  25.  *             We do NOT claim to be POSIX compliant.
  26.  *             If you want your code to be portable, don't use this interface.
  27.  */
  28.  
  29. #ifndef __FCNTL__
  30. #define __FCNTL__
  31.  
  32. #ifndef __TYPES__
  33. #include <Types.h>
  34. #endif
  35.  
  36. #ifndef __FILES__
  37. #include <Files.h>
  38. #endif
  39.  
  40. #ifndef __ALIASES__
  41. #include <Aliases.h>
  42. #endif
  43.  
  44. /*
  45.  *    For use by lseek():
  46.  */
  47.  
  48. #ifndef __STDIO__            /* these defns exactly paralled in StdIO.h for fseek() */
  49. #define SEEK_CUR    1
  50. #define SEEK_END    2
  51. #define SEEK_SET    0
  52. #endif
  53.  
  54. /*
  55.  * faccess() commands; for general use
  56.  */
  57.                      /* 'd' => "directory" ops */
  58. #define F_DELETE        (('d'<<8)|0x01)
  59. #define F_RENAME        (('d'<<8)|0x02)
  60.  
  61. /*
  62.  * more faccess() commands; for use only by MPW tools
  63.  */
  64.  
  65. #define F_OPEN             (('d'<<8)|0x00)        /* reserved for operating system use */
  66.                     /* 'e' => "editor" ops */
  67. #define F_GTABINFO         (('e'<<8)|0x00)        /* get tab offset for file */    
  68. #define F_STABINFO         (('e'<<8)|0x01)        /* set     "    "        "    "  */
  69. #define F_GFONTINFO        (('e'<<8)|0x02)        /* get font number and size for file */
  70. #define F_SFONTINFO        (('e'<<8)|0x03)        /* set     "        "    "    "    "    "      */
  71. #define F_GPRINTREC        (('e'<<8)|0x04)        /* get print record for file */
  72. #define F_SPRINTREC        (('e'<<8)|0x05)        /* set     "        "    "    "      */
  73. #define F_GSELINFO         (('e'<<8)|0x06)        /* get selection information for file */
  74. #define F_SSELINFO         (('e'<<8)|0x07)        /* set        "        "        "        " */
  75. #define F_GWININFO         (('e'<<8)|0x08)        /* get current window position */
  76. #define F_SWININFO         (('e'<<8)|0x09)        /* set    "        "        "        */
  77. #define F_GSCROLLINFO    (('e'<<8)|0x0A)        /* get scroll information */
  78. #define F_SSCROLLINFO    (('e'<<8)|0x0B)        /* set    "           "        */
  79. #define F_GMARKER        (('e'<<8)|0x0D)        /* Get Marker */
  80. #define F_SMARKER        (('e'<<8)|0x0C)        /* Set   "       */
  81. #define F_GSAVEONCLOSE    (('e'<<8)|0x0F)        /* Get Save on close */
  82. #define F_SSAVEONCLOSE    (('e'<<8)|0x0E)        /* Set   "     "     "      */
  83.  
  84. /*
  85.  *    argument structure for use with F_SMARKER command
  86.  */
  87. #ifdef powerc
  88. #pragma options align=mac68k
  89. #endif
  90. struct MarkElement {
  91.     int                start;            /* start position of mark */
  92.     int                end;            /* end position */
  93.     unsigned char    charCount;        /* number of chars in mark name */
  94.     char            name[64];        /* first char of mark name */
  95.                                     /* note: typically extra space is allocated */
  96. } ;                                    /*   in back to allow room for a longer string */
  97. #ifdef powerc
  98. #pragma options align=reset
  99. #endif
  100. #ifndef __cplusplus
  101. typedef struct MarkElement MarkElement;
  102. #endif
  103.  
  104. #ifdef powerc
  105. #pragma options align=mac68k
  106. #endif
  107. struct SelectionRecord {
  108.     long    startingPos;
  109.     long    endingPos;
  110.     long    displayTop;
  111. };
  112. #ifdef powerc
  113. #pragma options align=reset
  114. #endif
  115. #ifndef __cplusplus
  116. typedef struct SelectionRecord SelectionRecord;
  117. #endif
  118.  
  119. /*
  120.  * Mode values accessible to open()
  121.  */
  122. #define O_RDONLY         0         /* Bits 0 and 1 are used internally */
  123. #define O_WRONLY         1         /* Values 0..2 are historical */
  124. #define O_RDWR              2        /* NOTE: it goes 0, 1, 2, *!* 8, 16, 32, ... */
  125. #define O_APPEND    (1<< 3)        /* append (writes guaranteed at the end) */
  126. #define O_RSRC         (1<< 4)        /* Open the resource fork */
  127. #define O_ALIAS        (1<< 5)        /* Open alias file */
  128. #define O_CREAT        (1<< 8)        /* Open with file create */
  129. #define O_TRUNC        (1<< 9)        /* Open with truncation */
  130. #define O_EXCL         (1<<10)     /* w/ O_CREAT:  Exclusive "create-only" */
  131. #define O_BINARY    (1<<11)     /* Open as a binary stream */
  132. #define O_NRESOLVE    (1<<14)        /* Don't resolve any aliases */
  133.  
  134. #ifdef __cplusplus
  135. extern "C" {
  136. #endif
  137.  
  138. /*
  139.  *        function prototypes
  140.  */
  141. int  close(int);
  142. int  creat(const char*);
  143. int     dup(int filedes);        /* OBSOLETE: fcntl(filedes, F_DUPFD, 0) is preferred */
  144. int     faccess(char*, unsigned int, long*);
  145. int  fcntl(int, unsigned int, int);
  146. long lseek(int, long, int);
  147. int  open(const char*, int);
  148. int  read(int, char*, unsigned);
  149. int  unlink(char*);
  150. int  write(int, const char*, unsigned);
  151.  
  152. OSErr ResolveFolderAliases (
  153. /* Info in  */
  154.     short volume,
  155.     long directory,
  156.     StringPtr path,
  157.     Boolean resolveLeafName,
  158. /* Info out */
  159.     FSSpec *theSpec,
  160.     Boolean *isFolder,
  161.     Boolean *hadAlias,
  162.     Boolean *leafIsAlias);
  163.  
  164. OSErr MakeResolvedFSSpec (
  165.     short volume,
  166.     long directory,
  167.     StringPtr path,
  168.     FSSpec *theSpec,
  169.     Boolean *isFolder,
  170.     Boolean *hadAlias,
  171.     Boolean *leafIsAlias);
  172.  
  173. OSErr MakeResolvedPath (
  174.     short volume,
  175.     long directory,
  176.     StringPtr path,
  177.     Boolean resolveLeafAlias,
  178.     char *buffer,
  179.     Boolean *isFolder,
  180.     Boolean *hadAlias,
  181.     Boolean *leafIsAlias);
  182.  
  183. OSErr ResolvePath (
  184.     char *rawPath,
  185.     char *resolvedPath,
  186.     Boolean *isFolder,
  187.     Boolean *hadAlias);
  188.  
  189. pascal Boolean TrapAvailable (short trapNumber);
  190.     
  191. #ifdef __cplusplus
  192. }
  193. #endif
  194.  
  195. /*
  196.  * fcntl() commands
  197.  */
  198. #define F_DUPFD 0       /* Duplicate files (file descriptor) */
  199.  
  200. #endif    /*    __FCNTL__    */
  201.